import time

def sort(a):
    
    swapped = True
    while s1:
        s1 = False
        for i in range(len(a) - 1):
            if a[i] > a[i + 1]:
              
                a[i], a[i + 1] = a[i + 1], a[i]
               
                s1 = True

def read(filename):
    f = open(filename, 'r')
    d = f.readlines()
    return d

m1 = read("m1_sorted.txt")
m2 = read("m2_reverse.txt")
m3 = read("m3_shuffle.txt")

t1 = time.time()
sort(m1)
t2 = time.time()
print("m1_sorted",round((t2-t1)*1000),"milliseconds")

t1 = time.time()
sort(m2)
t2 = time.time()
print("m2_reverse",round((t2-t1)*1000),"milliseconds")

t1 = time.time()
sort(m3)
t2 = time.time()
print("m3_shuffle",round((t2-t1)*1000),"milliseconds")